#ifndef QS_RELAYS_H_
#define QS_RELAYS_H_
#include "qs_config.h"

#define	DRIVESTATE_TIMEOUT	3	// ca. 100ms

#define	INRUSH_TIME					500
#define INRUSH_TIMERSPEED			10
#define MAX_CURRENT_LIMIT   5500

enum driveDirection_t
{
	stopped,
	moving_down,
	moving_up
};

enum driveState_t
{
    stop        = 0,
    moveUp      = 1,
    stopUp      = 2,
    moveDown    = 3,
    stopDown    = 4,
    preUp       = 5,
    preDown     = 6,
    stopUp2     = 7,
    stopDown2   = 8,
};

void qs_pwm_dir_control(uint8_t idx, uint8_t dir);

void setPWMup(unsigned char drive,float pwm);
void setPWMdown(unsigned char drive,float pwm);
enum driveDirection_t qs_relays_direction(unsigned char drive);
enum driveState_t qs_relays_drivestate(unsigned char drive);
void qs_relay_init(void);
bool qs_relays_is_driving(unsigned char drive);
bool qs_relays_is_drivingUP(unsigned char drive);
bool qs_relays_is_drivingDOWN(unsigned char drive);
bool qs_motor_isMoving_active(void);
bool qs_motor_is_bottom_limit(unsigned char drive);
bool qs_motor_is_top_limit(unsigned char drive);
bool qs_motor_is_over_current(unsigned char drive);
void qs_relays_reverse_direction(uint8_t dir);
#endif
